package com.music.service.impl;

import com.music.common.BaseResult;
import com.music.dao.MusicSingerDtoMapper;
import com.music.dto.MusicSingerDto;
import com.music.service.MusicSingerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 2 * @Author: 刘佳乐 :面向百度编程
 * 3 * @Date: 2020/12/17 17:39
 * 4
 */
@Service
public class MusicSingerServiceImpl implements MusicSingerService {

    @Autowired
    MusicSingerDtoMapper musicSingerDtoMapper;

    @Override
    public BaseResult findMusicAndsName(Integer mId) {
        BaseResult baseResult=new BaseResult();
        MusicSingerDto musicAndsName = musicSingerDtoMapper.findMusicAndsName(mId);
        if(musicAndsName!=null){
            baseResult.setCode(200);
            baseResult.setMessage("查找成功");
            baseResult.setData(musicAndsName);
            return baseResult;
        }
        baseResult.setMessage("查找失败");
        baseResult.setCode(201);
        return baseResult;
    }

    @Override
    public BaseResult likesearch(String searchpoint) {
        BaseResult baseResult=new BaseResult();
        List<MusicSingerDto> likesearch = musicSingerDtoMapper.likesearch(searchpoint);
        if(likesearch.size()!=0){
            baseResult.setCode(200);
            baseResult.setMessage("查找成功");
            baseResult.setData(likesearch);
            return baseResult;
        }
        baseResult.setMessage("查找失败");
        baseResult.setCode(201);
        return baseResult;
    }


}
